package com.team.mp.api.controller;


import com.team.mp.api.bo.SysPermissionAddBo;
import com.team.mp.api.bo.SysPermissionBo;
import com.team.mp.api.service.intf.SysPermissionService;
import com.team.mp.vo.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 18.权限表(SysPermission)表控制层
 *
 * @author makejava
 * @since 2023-03-26 10:40:28
 */
@RestController
@RequestMapping("/api/syspermission/")
@Api(tags = "权限相关接口")
public class SysPermissionController{
    /**
     * 服务对象
     */
    @Resource
    private SysPermissionService service;

    /**
     * 新增*/
    @ApiOperation(value = "新增权限")
    @PostMapping("add")
    public R add(@RequestBody SysPermissionBo bo){
        return service.add(bo);
    }
    /**
     * 查询-列表*/
    @ApiOperation(value = "分页查询菜单")
    @GetMapping("page")
    public R page(){
        return service.queryAll();
    }
    /**
     * 查询-我的菜单*/
    @ApiOperation(value = "查询所有菜单")
    @GetMapping("menu")
    public R menu(){
        return service.queryMenuByUid();
    }
    /**
     * 查询-我的菜单*/
    @ApiOperation(value = "查询我的菜单")
    @GetMapping("menuvue3")
    public R menuVue3(){
        return service.queryMenuByUid();
    }
    /**
     * 查询-我的权限*/
    @ApiOperation(value = "查询我的权限")
    @GetMapping("perms")
    public R perms(){
        return service.queryPermByUid();
    }

    /**
     * 修改角色对应的权限或菜单*/
    @ApiOperation(value = "修改角色对应的权限或菜单")
    @PostMapping("updaterp")
    public R updateRp(@RequestBody SysPermissionAddBo bo){
        return service.updateByUid(bo);
    }
}
